package com.sc.nft.entity.vo;

import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sc.nft.entity.RegisterNeckCollection;
import com.sc.nft.entity.UserInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Pattern;
@Data
public class RegisterNeckCollectionVO {
    @JsonIgnore
    @ApiModelProperty("用户信息")
    private UserInfo userInfo;

    @JsonIgnore
    @ApiModelProperty("用户是否存在")
    private Boolean userExist;

    @JsonIgnore
    @ApiModelProperty("是否领取")
    private Boolean neckExist;

    @JsonIgnore
    @ApiModelProperty("领取藏品信息")
    private RegisterNeckCollection registerNeckCollection;

    @JsonIgnore
    @ApiModelProperty("用户手机号")
    private String userTel;

    @ApiModelProperty("二维码")
    private String qrCode="http://local.gometa.com.cn/reg/index.html#/download";

    @ApiModelProperty("是否领取,这个字段是告知前端,用这个字段判定用什么进行展示  true:领取成功  false:他已经领取过了")
    private Boolean isNeck;

    @ApiModelProperty("用户密码")
    @JsonIgnore
    private String pass;

    public void setUserInfo(UserInfo userInfo) {
        this.userExist = BeanUtil.isNotEmpty(userInfo);
        this.userInfo = userInfo;
    }

    public void setRegisterNeckCollection(RegisterNeckCollection registerNeckCollection) {
        this.neckExist = BeanUtil.isNotEmpty(registerNeckCollection);
        this.registerNeckCollection = registerNeckCollection;
    }

    public void setUserTel(String userTel) {
        // 截取手机号后6位
        String pass = userTel.substring(userTel.length() - 6);
        this.pass=pass;
        this.userTel = userTel;
    }
}
